﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using OS.Infrastructure.Domain;

namespace Domain
{
    public class Account : BaseModel<Account>, IEntity
    {
        public Account()
        {
            Urls = new List<Url>();
        }
        public virtual int Id { get; set; }
        public virtual String Name { get;protected set; }

        public virtual String Password { get; protected set; }

        public virtual IList<Url> Urls { get; set; }

        public virtual bool ChangePassword(string oldPassword, string newPassword)
        {
            if (oldPassword != Password)
            {
                return false;
            }
            else
            {
                Password = newPassword;
                return true;
            }
        }
        public virtual void NewAccount(string userName, string password)
        {
            Name = userName;
            Password = password;
        }
    }
}
